package com.llongwill.slg.gateway.common;

import com.xiangff.base.framework.resp.ResponseCode;
import lombok.Getter;

/**
 * 错误编码类，不同的错误编码前缀不同。
 *
 * @author xiangff
 */
public enum GwReqErrorCode implements ResponseCode {
    //基础验证
    NULL_PARAM("GW_0_", "1", "参数不能为空!"),
    USER_NOT_EXISTS("GW_0_", "2", "用户名密码错误!"),
    USER_USER_NAMEPASSWORD_WRONG("GW_0_", "2", "用户名密码错误!"),
    UNLOGIN("GW_0_", "2", "未登录!"),
    NO_ROLE("GW_0_", "3", "无权限!"),

    ;

    @Getter
    private String code;

    @Getter
    private String remark;

    /**
     * 创建错误编码，错误编码由prefix和code组成
     *
     * @param prefix 错误编码前缀
     * @param code   错误编码
     * @param remark 备注
     */
    GwReqErrorCode(String prefix, String code, String remark) {
        this.code = prefix + code;
        this.remark = remark;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return remark;
    }
}

